/// <reference path="DreamSpaceJS\Bootstrap.ts"/>
/// <reference path="DreamSpaceJS\DreamSpaceClient.ts"/>

import UI = DreamSpace.UI;
import Bootstrap = DreamSpace.Bootstrap;

class ICEManager extends DreamSpace.Application {

    constructor(content: HTMLElement) {
        super("ICE Manager", "Easily develop and managed interfacing solutions.", content);
    }

    buildUI() {
        var h1 = new UI.Header(this, "Channel Status", 1);
        var btn = new Bootstrap.Button(this, Bootstrap.ButtonTypes.Primary, Bootstrap.ButtonSize.Default);
        var text = new UI.PlainText(btn, "New Channel");
        var table = new Bootstrap.Table(this);
        var tableRow = new Bootstrap.TableRow(table, Bootstrap.RowStates.Success);
        text = new UI.PlainText(tableRow, "!!!");
        //!!setTimeout(() => { btn.buttonType(Bootstrap.ButtonTypes.Success); }, 8000);
    }

}

DreamSpace.setFunctionNames(this, "ICEManager");

var app: ICEManager;

DreamSpace.onReady = () => {
    var content = document.getElementById('content');
    app = <ICEManager>$DS.addApplication(new ICEManager(content));
    host.setTitle(app.title);
    app.buildUI();
    app.updateLayout();

    if (host.isDreamSpaceStudio() || host.isDreamSpaceServer()) {
        var channel = $ICE.createChannel("SAP to Command");
    }
};

if (typeof window != "undefined")
    window.onload = (function onload() { (<any>$DS).onLoaded(); });
else 
    (<any>$DS).onLoaded();
